<template>
  <div class="view-fill">
    <div v-if="!modifyInfo.visible" class="app-container-flex">
      <NewFullScreen title="计量器具检定详情" @returnBack="returnBack">
        <div class="model-panel">
          <div class="model-panel-body">
            <BasicInformation :info="infoList">
              <template v-slot:basic-filePathList>
                <EleGallery
                  v-if="infoList.data.filePathList"
                  :lazy="true"
                  :size="150"
                  :source="infoList.data.filePathList"
                  title="附件"
                />
                <span v-else>-</span>
              </template>
            </BasicInformation>
          </div>
        </div>
      </NewFullScreen>
    </div>
  </div>
</template>

<script setup name="AssetInstrumentsPlanDetail">
import EleGallery from '@/components/UploadImgNew/eleGallery'
import { getMeasuringVerificationRecordById } from '@/api/quality.js'
const props = defineProps(['visible', 'id'])
const { proxy } = getCurrentInstance()
const infoList = ref({
  data: {
    filePathList: '',
  },
  fieldList: [
    {
      label: '标准名称',
      value: 'commonName',
      type: 'text',
    },
    { label: '器具编码', value: 'code', type: 'text' },
    { label: '资产名称', value: 'assetName', type: 'text' },
    { label: '资产卡片号', value: 'assetCode', type: 'text' },
    { label: '规格', value: 'standard', type: 'text' },
    {
      label: '是否强检',
      value: 'isMandatoryInspectionValue',
      type: 'text',
    },
    { label: '检定日期', value: 'verificationDate', type: 'text' },
    {
      label: '证书编号',
      value: 'verificationCertificateNumber',
      type: 'text',
    },
    { label: '检定类型', value: 'verificationTypeValue', type: 'text' },
    { label: '检定结果', value: 'verificationResultValue', type: 'text' },
    { label: '检定单位', value: 'verificationUnit', type: 'text' },
    { label: '附件', value: 'filePathList', type: 'slot' },
  ],
})
const modifyInfo = ref({
  visible: false,
  title: '',
})
function handleRemove(index) {
  if (multiple.value) {
    const data = [...computedValues.value]
    data.splice(index, 1)
    proxy.$emit('input', data || [])
  } else {
    proxy.$emit('input', null)
  }
}
function _getRecordByPlanId() {
  getMeasuringVerificationRecordById(props.id).then((res) => {
    if (res.success) {
      infoList.value.data = res.data
    }
  })
}
function returnBack() {
  modifyInfo.value.visible = false
  proxy.$emit('returnBack', false)
}

_getRecordByPlanId()
</script>

<style scoped></style>
